from .models import MomentPl

def getMomentPl(moment):
    pls = moment.moment.all()
    pl_data = []
    for i in pls:
        pl_data.append({
            'user': i.user.username,
            'data': i.data
        })
    return pl_data

def getImage(moment):
    imgs = moment.m_img.all()
    images = []
    for i in imgs:
        images.append({
            'id':i.id,
            'image':i.image_src
        })
    return images